﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using SlamCms.Web.Mvc;

namespace System.Web.Mvc
{
	public static class HtmlHelperBuilderExtensions
	{
		public static HtmlGrid<TProperty> Grid<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, IEnumerable<TProperty>>> modelAccessor) where TProperty : class
		{
			return new HtmlGrid<TProperty>(htmlHelper, modelAccessor.Compile().Invoke(htmlHelper.ViewData.Model));
		}
	}
}
